package com.servlet.checking;

import com.domain.Checking;
import com.service.CheckingService;
import com.service.impl.CheckingServiceImpl;
import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/checkingDeleteServlet")
public class checkingDeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        Checking checking = new Checking();
        String id = request.getParameter("uid");
        checking.setUid(Integer.parseInt(id));
        CheckingService service = new CheckingServiceImpl();
        Boolean isDel = service.delete(Integer.parseInt(id));
        if(isDel){
            response.getWriter().write("{\"status\":\"0\",\"message\":\"deok\"}");
        }else{
            response.getWriter().write("{\"status\":\"1\",\"message\":\"don\"}");
        }

    }
}
